package com.ruoyi.park.service.impl;

import java.util.List;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.park.mapper.MaHouseMaterialMapper;
import com.ruoyi.park.domain.MaHouseMaterial;
import com.ruoyi.park.service.IMaHouseMaterialService;

/**
 * 仓库物资Service业务层处理
 *
 * @author cjie
 * @date 2021-09-16
 */
@Service
public class MaHouseMaterialServiceImpl implements IMaHouseMaterialService {
    @Autowired
    private MaHouseMaterialMapper maHouseMaterialMapper;

    /**
     * 查询仓库物资
     *
     * @param id 仓库物资ID
     * @return 仓库物资
     */
    @Override
    public MaHouseMaterial selectMaHouseMaterialById(String id) {
        return maHouseMaterialMapper.selectMaHouseMaterialById(id);
    }

    /**
     * 查询仓库物资列表
     *
     * @param maHouseMaterial 仓库物资
     * @return 仓库物资
     */
    @Override
    public List<MaHouseMaterial> selectMaHouseMaterialList(MaHouseMaterial maHouseMaterial) {
        return maHouseMaterialMapper.selectMaHouseMaterialList(maHouseMaterial);
    }

    /**
     * 新增仓库物资
     *
     * @param maHouseMaterial 仓库物资
     * @return 结果
     */
    @Override
    public int insertMaHouseMaterial(MaHouseMaterial maHouseMaterial) {
        maHouseMaterial.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        return maHouseMaterialMapper.insertMaHouseMaterial(maHouseMaterial);
    }

    /**
     * 修改仓库物资
     *
     * @param maHouseMaterial 仓库物资
     * @return 结果
     */
    @Override
    public int updateMaHouseMaterial(MaHouseMaterial maHouseMaterial) {
        return maHouseMaterialMapper.updateMaHouseMaterial(maHouseMaterial);
    }

    /**
     * 批量删除仓库物资
     *
     * @param ids 需要删除的仓库物资ID
     * @return 结果
     */
    @Override
    public int deleteMaHouseMaterialByIds(String[] ids) {
        return maHouseMaterialMapper.deleteMaHouseMaterialByIds(ids);
    }

    /**
     * 删除仓库物资信息
     *
     * @param id 仓库物资ID
     * @return 结果
     */
    @Override
    public int deleteMaHouseMaterialById(String id) {
        return maHouseMaterialMapper.deleteMaHouseMaterialById(id);
    }
}
